package com.gitee.wsl.data.state.observing

/**
 * Has information about observers of a replica.
 */
data class ObservingState(
    val observerIds: Set<Long> = emptySet(),
    val activeObserverIds: Set<Long> = emptySet(),
    val observingTime: ObservingTime = ObservingTime.Never
) {

    val observerCount get() = observerIds.size

    val activeObserverCount get() = activeObserverIds.size

    val status: ObservingStatus
        get() = when {
            activeObserverCount > 0 -> ObservingStatus.Active
            observerCount > 0 -> ObservingStatus.Inactive
            else -> ObservingStatus.None
        }
}

enum class ObservingStatus {
    None, Inactive, Active
}

